#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
#define rep(i, a, b) for (int i = (a); i <= (b); i++)
#define per(i, a, b) for (int i = (a); i >= (b); i--)
#define endl '\n'
const int N = 2e5 + 5;

int n, m;
ll a[N];
int b[N];
bool cmp(int x, int y) { return a[x] < a[y]; }
struct Node {
  int pre, nxt;
  int v;
} lst[N];
int pos[N];
int ans[N];

int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> n;
  rep(i, 1, n) cin >> a[i];
  rep(i, 1, n) b[i] = i;
  sort(b + 1, b + n + 1, cmp);
  rep(i, 1, n) {
    lst[i].v = b[i];
    lst[i].pre = i - 1, lst[i].nxt = i + 1;
    pos[b[i]] = i;
  }
  lst[0].nxt = 1, lst[n + 1].pre = n;
  a[0] = 1e18;
  per(i, n, 2) {
    int x = pos[i];
    int pre = lst[x].pre, nxt = lst[x].nxt;
    int y = lst[pre].v, z = lst[nxt].v;
    if (abs(a[i] - a[y]) < abs(a[i] - a[ans[i]])) ans[i] = y;
    if (abs(a[i] - a[z]) < abs(a[i] - a[ans[i]])) ans[i] = z;
    lst[pre].nxt = nxt;
    lst[nxt].pre = pre;
  }
  rep(i, 2, n) cout << abs(a[i] - a[ans[i]]) << ' ' << ans[i] << endl;
  return 0;
}